/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DTO;

/**
 *
 * @author LUCKYSTARS
 */
public class Function {
     public String ID_Ketiep(String ID_cuoi, String tiento)
        {
            int ID = Integer.parseInt(ID_cuoi.substring(tiento.length())) + 1;
            //ID = day cac so 0000 phia sau tien to vd tien to "CT_000009"+1 ->ID=10
            int Dodaiso = ID_cuoi.length() - tiento.length();
            // dem do dai so sau tien to;
            String zeroNumber = "";//tao day cac so 0
            String sautiento = "";
            for (int i = 1; i <= Dodaiso-1; i++)
            {
                        zeroNumber += "0";    
            }
            sautiento+=zeroNumber + ID;// tao ra sau tien to 1 day moi luc nay la 0000010
            //luc nay sautiento co 7kt mat dinh co 6 kt nen can xoa bot 1 so 0 tao bien sotru de loai bo so 0
            int sotru = sautiento.length() - Dodaiso;//o day do dai sautiento =7 dodaiso =6 -> sotru =1 
            String sautientoThat = sautiento.substring(sotru);//loai bo 1 kt 0 o vitri 0 cua sautiento
            return tiento + sautientoThat;//tra ve gi ID moi = CT_000010

        }
}
